<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="ECharts">
    <title>ECharts · Example</title>


    <!-- 导入script -->
    <!-- http://echarts.baidu.com/echarts2/doc/example/www/js/echarts.js -->
    <!--<script src="./www/js/echarts.js"></script>-->
    <script src="http://echarts.baidu.com/echarts2/doc/example/www/js/echarts.js"></script>
    <script src="./android.js"></script>

</head>

<body onLoad="loadALineChart()">
<div id="chart2" style="height:500px;width:400px"></div>


<script type="text/javascript">

        // 路径配置
        require.config({
          paths: {
            echarts: 'http://echarts.baidu.com/echarts2/doc/example/www/js'
            //echarts: './www/js'
          }
        });


        // 使用
        require(
          [
            'echarts',
            'echarts/chart/line', // 使用柱状图就加载line模块，按需加载
            'echarts/chart/bar', // 使用柱状图就加载bar模块，按需加载
            'echarts/chart/pie', // 使用柱状图就加载pie模块，按需加载
          ],
          function (ec) {
            // 基于准备好的dom，初始化echarts图表
            var myChart = ec.init(document.getElementById('main'));
            //设置数据
            var option = {
             title: {
                text: '危险货物趋势图',
                subtext: '单位:万吨'
            },
            legend: {
                data:[ ]
            },
            toolbox: {
                show : true,
                feature : {
                    mark : {show: true},
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            calculable : true,
            tooltip : {
                trigger: 'axis',
                formatter: "Temperature : <br/>{b}km : {c}°C"
            },
            xAxis : [
                {
                    type : 'value',
                    axisLabel : {
                        formatter: '{value} °C'
                    }
                }
            ],
            yAxis : [
                {
                    type : 'category',
                    axisLine : {onZero: false},
                    axisLabel : {
                        formatter: '{value} km'
                    },
                    boundaryGap : false,
                    data : ['0', '10', '20', '30', '40', '50', '60', '70', '80']
                }
            ],
            series : [
                {
                    name:'高度(km)与气温(°C)变化关系',
                    type:'line',
                    smooth:true,
                    itemStyle: {
                        normal: {
                            lineStyle: {
                                shadowColor : 'rgba(0,0,0,0.4)'
                            }
                        }
                    },
                    data:[15, -50, -56.5, -46.5, -22.1, -2.5, -27.7, -55.7, -76.5]
                }
            ]
        };


            // 为echarts对象加载数据
            myChart.setOption(option);
          }

        )



</script>



<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
</body>
</html>
